package com.myz.file;

import com.myz.file.facade.entity.FileRequest;
import com.myz.file.facade.entity.FileResponse;
import com.myz.file.facade.service.FileService;
import com.myz.file.facade.service.TestDemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author menyongzhi
 * @date 2025/11/4
 * @apiNote
 */
@RestController
@RequestMapping("/dubbo")
public class DubboController {

    @DubboReference(version = "1.0.0")
    private TestDemoService testDemoService;

    @DubboReference(version = "1.0.0",timeout = 300000)
    private FileService fileService;

    @GetMapping("/sayHello/{name}")
    public String sayHello(@PathVariable("name") String name){
        return testDemoService.sayHello(name);
    }

    @PostMapping("/selectAll")
    public FileResponse selectAll(@RequestBody FileRequest request){
        return fileService.execute(request);
    }

    @PostMapping("/parseFile2DB")
    public FileResponse parseFile2DB(@RequestBody FileRequest request){
        return fileService.execute(request);
    }


}
